{% extends "layout.html" %}

{% block content %}
    <div class="container-fluid">
    <ol class="breadcrumb">
        <li><a href="/">后台管理</a></li>
        <li><a href="javascript:void(0);" onclick="$('#menu-user').trigger('click');">会员管理</a></li>
        <li class="active">会员信息</li>
    </ol>

    {# 表单 #}
    <form class="form-horizontal" method="post" action="">
        {{ form.csrf_token }}
        {{ form.user_id() }}
        {# 标签导航 #}
        <ul class="nav nav-tabs">  {# 填充整个导航条：nav-justified #}
            <li role="presentation"><a href="{{ url_for('user.auth', user_id=form.user_id.data) }}">登录信息</a></li>
            <li role="presentation"><a href="{{ url_for('user.bank', user_id=form.user_id.data) }}">银行信息</a></li>
            <li role="presentation" class="active"><a href="{{ url_for('user.profile', user_id=form.user_id.data) }}">基本信息</a></li>
        </ul>
        <p></p>
        <div class="form-group{% if form.user_pid.errors %} has-error{% endif %}">
            {{ form.user_pid.label(class="col-sm-2 control-label") }}
            <div class="col-sm-10">
                {{ form.user_pid(class="form-control", placeholder="Pid") }}
                {% for error in form.user_pid.errors %}
                    <span class="help-block">{{ error }}</span>
                {% endfor %}
                <span class="help-block">推荐人名称：{{ form.user_pid.data | nickname }}</span>
            </div>
        </div>
        <div class="form-group{% if form.nickname.errors %} has-error{% endif %}">
            {{ form.nickname.label(class="col-sm-2 control-label") }}
            <div class="col-sm-10">
                {{ form.nickname(class="form-control", placeholder="用户名称", disabled="disabled") }}
                {% for error in form.nickname.errors %}
                    <span class="help-block">{{ error }}</span>
                {% endfor %}
            </div>
        </div>
        <div class="form-group{% if form.email.errors %} has-error{% endif %}">
            {{ form.email.label(class="col-sm-2 control-label") }}
            <div class="col-sm-10">
                {{ form.email(class="form-control", placeholder="电子邮箱") }}
                {% for error in form.email.errors %}
                    <span class="help-block">{{ error }}</span>
                {% endfor %}
            </div>
        </div>
        <div class="form-group{% if form.area_id.errors %} has-error{% endif %}">
            {{ form.area_id.label(class="col-sm-2 control-label") }}
            <div class="col-sm-10">
                {{ form.area_id(data_header="选择手机区号") }}
                {% for error in form.area_id.errors %}
                    <span class="help-block">{{ error }}</span>
                {% endfor %}
            </div>
        </div>
        <div class="form-group{% if form.phone.errors %} has-error{% endif %}">
            {{ form.phone.label(class="col-sm-2 control-label") }}
            <div class="col-sm-10">
                {{ form.phone(class="form-control", placeholder="手机号码", type="tel", maxlength=11) }}
                {% for error in form.phone.errors %}
                    <span class="help-block">{{ error }}</span>
                {% endfor %}
            </div>
        </div>
        <div class="form-group{% if form.birthday.errors %} has-error{% endif %}">
            {{ form.birthday.label(class="col-sm-2 control-label") }}
            <div class="col-sm-10">
                {{ form.birthday(class="form-control", placeholder="Birthday", type="date") }}
                {% for error in form.birthday.errors %}
                    <span class="help-block">{{ error }}</span>
                {% endfor %}
            </div>
        </div>
        <div class="form-group{% if form.real_name.errors %} has-error{% endif %}">
                    {{ form.real_name.label(class="col-sm-2 control-label") }}
                    <div class="col-sm-10">
                        {{ form.real_name(class="form-control", placeholder="真实姓名") }}
                        {% for error in form.real_name.errors %}
                            <span class="help-block">{{ error }}</span>
                        {% endfor %}
                    </div>
                </div>
        <div class="form-group{% if form.id_card.errors %} has-error{% endif %}">
            {{ form.id_card.label(class="col-sm-2 control-label") }}
            <div class="col-sm-10">
                {{ form.id_card(class="form-control", placeholder="身份证号", maxlength=18) }}
                {% for error in form.id_card.errors %}
                    <span class="help-block">{{ error }}</span>
                {% endfor %}
            </div>
        </div>
        <div class="form-group{% if form.create_time.errors %} has-error{% endif %}">
            {{ form.create_time.label(class="col-sm-2 control-label") }}
            <div class="col-sm-10">
                <div class="form-control">
                    {{ moment(form.create_time.data).format('YYYY-MM-DD HH:mm:ss') }}
                </div>
                {% for error in form.create_time.errors %}
                    <span class="help-block">{{ error }}</span>
                {% endfor %}
            </div>
        </div>
        <div class="form-group{% if form.update_time.errors %} has-error{% endif %}">
            {{ form.update_time.label(class="col-sm-2 control-label") }}
            <div class="col-sm-10">
                <div class="form-control">
                    {{ moment(form.update_time.data).format('YYYY-MM-DD HH:mm:ss') }}
                </div>
                {% for error in form.update_time.errors %}
                    <span class="help-block">{{ error }}</span>
                {% endfor %}
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-success btn-load" data-loading-text="保存中">保存</button>
                <button type="reset" class="btn btn-default">重新填写</button>
            </div>
        </div>
    </form>


    </div>

{% endblock %}

{% block extra_js %}
<script>
    // 初始化赋值
    var area_id = $('#area_id');
    area_id.selectpicker('val', '{{ form.area_id.data }}');
    // 处理选项修改
    area_id.on('changed.bs.select', function (event, clickedIndex, newValue, oldValue) {
        // console.log($('#area_id').val());
        // console.log(event);
        // console.log(clickedIndex);
        // console.log(newValue);
        // console.log(oldValue);
    });
</script>
{% endblock %}
